/*NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

	Copyright (c) 2009 Jounayd Id Salah.
	All rights reserved.

	This file is part of Blacklib.

	Blacklib is free software: you can redistribute it and/or modify it under the 
	terms of the GNU Lesser General Public License as published by the Free Software 
	Foundation, either version 3 of the License, or (at your option) any later version.
	Blacklib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
	without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
	PURPOSE.  See the GNU Lesser General Public License for more details.
	You should have received a copy of the GNU Lesser General Public License along with 
	Blacklib.  If not, see <http://www.gnu.org/licenses/>.
*/
//NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

#include "maths/func.h"

namespace black
{
	//__________________________________________________________________________
	uint adler32( const data8 pVals[], size_t szNbVals )
	{
		register uint a = 1;
		register uint b = 0;

		data8* pData = const_cast<data8*>( pVals );

		while ( szNbVals != 0 )
		{
			a = mod( static_cast<uint>( a + *pData++ ), (uint)65521 );
			b = mod( static_cast<uint>( b + a ), (uint)65521 );

			--szNbVals;
		}

		return ( b << 16 ) | a;
	}

	//__________________________________________________________________________
	uint crc32( const data8 /*pVals*/[], const size_t /*szNbVals*/ )
	{
		uint uiRes = 0;
		return uiRes;
	}
}
